﻿namespace WMS6.SQLServerDAL
{
    using System;
    using System.Data;
    using System.Data.SqlClient;
    using System.Text;
    using WMS6.Common;
    using WMS6.DataEntity;
    using WMS6.DBUtility;
    using WMS6.IDAL;

    public class OperationLogDA : IOperationLogDA
    {
        public int InsertOperationLog(OperationLogInfo operationLogInfo)
        {
            int result = 0;
            try
            {
                StringBuilder strSQL = new StringBuilder();
                strSQL.AppendFormat("INSERT INTO {0}OPERATION_LOG (WH_ID,USER_ID,LOG_DATE,OPERATION_DESCR,UDF1,UDF2,UDF3,UDF4,UDF5) ", ConstUtils.CONST_GLOBAL_TABLE);
                strSQL.AppendFormat(" VALUES ('{0}','{1}',GETDATE(),'{2}','{3}','{4}','{5}','{6}','{7}')", new object[] { operationLogInfo.WhID, operationLogInfo.UserID, operationLogInfo.OperationDescr, operationLogInfo.Udf1, operationLogInfo.Udf2, operationLogInfo.Udf3, operationLogInfo.Udf4, operationLogInfo.Udf5 });
                result = DBHelper.ExecuteNonQuery(CommandType.Text, strSQL.ToString());
            }
            catch (SqlException sqlex)
            {
                CommonErrorHandler.ErrorHandler(sqlex, LogType.Error);
            }
            return result;
        }
    }
}

